

package	org.jdamico.socks.server.commons;

import org.jdamico.socks.server.SocksProxy;



public class DebugLog
{
	
	private static DebugLog INSTANCE = null;
	private DebugLog() {}
	
	public static DebugLog getInstance(){
		if(INSTANCE==null) {
			synchronized(DebugLog.class) {
				if(INSTANCE == null) {
					INSTANCE = new DebugLog();
				}
			}
		}
		return INSTANCE;
	}

	
	public	void println( String txt )	{
		if(SocksProxy.enableDebugLog )	{
			print( txt + Configs.EOL );
		}
	}

	
	public	void	print( String txt )	{
		if( !SocksProxy.enableDebugLog )	return;
		if( txt == null )	return;
		System.out.print( txt );	
	}
	
	
	public	void	error( String txt )	{
		if( SocksProxy.enableDebugLog )	System.err.println( "Error : " + txt );
	}
	
	
	public	void	error( Exception e )	{
		if( !SocksProxy.enableDebugLog )	return;
		System.err.println( "ERROR : " + e.toString() );
		e.printStackTrace();
	}
	

	
	
	
	
}
